<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css"/>
    <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
</head>
<body>
<b>
    <p>
        Today is <u><label id="today"></label></u>
    </p>
</b>
<br>
<div id="pi" class="alert alert-primary"></div>
<py-script>
import datetime as dt
# 这是Python注释，将字符串写到HTML页面的标签中
pyscript.write('today', dt.date.today().strftime('%A %B %d, %Y'))

def computer_pi(n):
    pi = 2
    for i in range(1, n):
        pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
    return pi

pi = computer_pi(10000)
pyscript.write('pi',f'π is approximately {pi:.10f}')
</py-script>
</body>
</html>